Skip to content

SQLite3 Instrumentation#719

Merged
toumorokoshi merged 4 commits intoopen-telemetry:masterfrom
cnnradams:sqlite3-instrumentation
May 21, 2020
Merged

SQLite3 Instrumentation#719
toumorokoshi merged 4 commits intoopen-telemetry:masterfrom
cnnradams:sqlite3-instrumentation

Conversation

@cnnradams
Copy link
Copy Markdown
Member

@cnnradams cnnradams commented May 21, 2020

Adds instrumentation for python sqlite3 library.

There is a lot of repeat code in the SQLite3Instrumentor (shared with every other DBAPI instrumentor), it could possibly be pulled out into a DBAPIInstrumentor that can be subclassed in this PR or another.

Resolves #683

@cnnradams cnnradams requested a review from a team May 21, 2020 13:50
@cnnradams cnnradams force-pushed the sqlite3-instrumentation branch 2 times, most recently from 11e94e5 to c906159 Compare May 21, 2020 14:28
@cnnradams cnnradams force-pushed the sqlite3-instrumentation branch from c906159 to ece7b41 Compare May 21, 2020 15:02
Copy link
Copy Markdown
Member

@c24t c24t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!


cnx = sqlite3.connect('example.db')
cursor = cnx.cursor()
cursor.execute("INSERT INTO test (testField) VALUES (123)"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing closing ")"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread tox.ini Outdated
flask,django: pip install {toxinidir}/opentelemetry-auto-instrumentation
flask: pip install {toxinidir}/ext/opentelemetry-ext-flask[test]

dbapi: pip install {toxinidir}/opentelemetry-auto-instrumentation
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the auto-instrumentation module for this test suite?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not anymore; removed

Copy link
Copy Markdown
Contributor

@lzchen lzchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some non-blocking comments

Copy link
Copy Markdown
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, it would be nice to add docker tests for this integration, maybe creating an issue for it so we don't forget.

@toumorokoshi
Copy link
Copy Markdown
Member

There is a lot of repeat code in the SQLite3Instrumentor (shared with every other DBAPI instrumentor), it could possibly be pulled out into a DBAPIInstrumentor that can be subclassed in this PR or another.

@cnnradams if that's the case, can you file a ticket and pick this up as a followup PR? Would love to pay down this debt as we go along.

Regarding where to put this code, I'm open to either a more specific shared package (e.g. opentelemetry-instrumentation-dbapi), or a mega-shared package for all shared utils across all instrumentations.

@codeboten @c24t for their thoughts. In the meantime I'll merge this PR. Thanks!

@toumorokoshi toumorokoshi merged commit 58b7bcc into open-telemetry:master May 21, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this pull request Nov 1, 2020
test: fix and add tests
closes open-telemetry#642

Signed-off-by: Olivier Albertini <olivier.albertini@montreal.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add instrumentation for sqlite3

5 participants